import React from 'react';
import { inject, observer } from 'mobx-react';
import { withRouter, Route, Link } from 'react-router-dom';
import { Icon,Tools,ActionSheet} from 'weaver-mobile';
import TaskViewPath from '../tree/path'
import { TabPage,RouteLayout  } from 'weaver-mobile-page';
import classnames from 'classnames';
import './index.less';
import HOCcomponent from "../info/hocComponent";
const { getLabel } = Tools;

const isIPhone = new RegExp('\\biPhone\\b|\\biPod\\b', 'i').test(window.navigator.userAgent);
let wrapProps;
if (isIPhone) {
  wrapProps = {
    onTouchStart: e => e.preventDefault(),
  };
}
@inject('governmindStore')
@withRouter
@observer
class taskview  extends React.Component {

  componentDidMount =()=>{
    const { governmindStore,location: { search,pathname }} = this.props;
    const id = search.substr(search.indexOf("=") + 1);
    this.mindparam = {id}
    governmindStore.init(this.mindparam);
  }
  
    switchPcLayout() {
      // if (!window.e9mobileConfig) {
      //   window.e9mobileConfig = {
      //     orientation: 2, // 0 竖屏 1 横屏 2 跟随
      //   }
      // } 
      // if(window.e9mobileConfig.orientation == 0) {
      //   window.e9mobileConfig.orientation = 2;
      // } else {
      //   window.e9mobileConfig.orientation = 0;
      // }
      if(window.em) {
        window.em.getOrientation({
          success: function (res) {
           const corientation = res.orientation === 0 ? 1 : 0;
          window.em.changeOrientation({
            orientation:corientation, // 0,竖屏(默认)，1，横屏，2，跟随屏幕转动
            success: function (res) {
            }
        });
          }
      });
        
      }
      
    }

    render() {
        const { governmindStore} = this.props;

        return (
                <div className="govern-task-view">
                  <div className={classnames("govern-task-view-content",'govern-task-view-content-all')}>
                    <TaskViewPath store={governmindStore} {...this.props}/>
                  </div>
            </div>
        )
    }

}
export default HOCcomponent(taskview);